package com.nulldev.util.web.HttpClient;

public enum ResponseFormat {
	/**
	 * Provides a <code>String</code> with the fully read content. <br>
	 * No compression is used during transfer.
	 */
	STRING(false),
	/**
	 * Provides a <code>String</code> with the fully read content. <br>
	 * Enables support for compression methods like GZIP and DEFLATE.
	 */
	STRING_VIA_STREAM(true),
	/**
	 * Provides a <code>byte[]</code> with the fully read content. <br>
	 * No compression is used, hence a raw array is provided.
	 */
	BYTES(false),
	/**
	 * Provides a <code>InputStream</code> which is piped directly from the
	 * connection. <br>
	 * Content may be decoded on the fly behind the scenes. <br>
	 * Compression support is enabled.
	 */
	STREAM(true),

	/* Added in 1.2.9 */

	/**
	 * Provides a <code>Reader</code> object which is piped from
	 * <code>STREAM</code>. <br>
	 * Compression support is enabled.
	 * 
	 * @since HttpClient 1.2.9 (nullUtil 3.0.1)
	 */
	READER(true)

	;

	public final boolean allowCompression;

	private ResponseFormat(final boolean allowCompression) {
		this.allowCompression = allowCompression;
	}

	public boolean isCompressionAllowed() {
		return this.allowCompression;
	}
}
